Window Utilities (WinUtils)
This section describes the utilities defined in the files WinUtils.h and WinUtils.cpp. When you're reopening a window at document-launch time, you can use these utilities to retrieve the window properties stored with the root frame of any persistently stored window.Retrieving Window Properties
When a saved document is opened, OpenDoc retrieves the root frame of each saved window and calls theOpen
method of the part belonging to that frame, passing the frame. The part is responsible for recreating the platform window and creating anODWindow
object using theRegisterWindowForFrame
method.The properties of the window are saved in a storage unit referenced from the root frame. The utility functions
BeginGetWindowProperties
andEndGetWindowProperties
can be used to retrieve these properties without using the storage system API directly.Using the Window Utilities
The window utilities functions allow a part editor to obtain the properties necessary to create a window from the storage annotation on a root frame. TheBeginGetWindowProperties
function returnskODTrue
if the annotation exists and fills in theproperties
structure. TheEndGetWindProperties
function releases the frame specified in thesourceFrame
field of the structure.The following code fragment illustrates use of the window utilities:
WindowProperties props; ODWindow* window = kODNULL; if (BeginGetWindowProperties(ev, frame, &props)) { ODPlatformWindow platformWindow = NewCWindow(kODNULL, &(props.boundsRect), props.title, kODFalse, props.procID, (WindowPtr)-1L, props.hasCloseBox, props.refCon); window = fSession->GetWindowState(ev)->RegisterWindowForFrame(ev, platformWindow, frame, props.isRootWindow,// keeps draft open kODTrue,// is resizable kODFalse,// is floating kODTrue,// shouldSave props.sourceFrame); EndGetWindowProperties(ev, &props); // release source frame }
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help